package cn.com.bsoft.mobile.test

import com.dd.plist.NSDictionary
import com.dd.plist.PropertyListParser
import org.junit.Test
import java.io.ByteArrayOutputStream
import com.dd.plist.NSArray



class PListTest{
    @Test
    fun test1(){
        val root = NSDictionary()
        val item = NSDictionary()



        val assets = NSDictionary()

        assets.put("kind","software-package")
        assets.put("url","url")

        val metadata = NSDictionary()

        metadata.put("bundle-identifier","开发者证书用户名")
        metadata.put("bundle-version","1.0")
        metadata.put("kind","software")
        metadata.put("title","AppName")

        item.put("assets",NSArray(assets))
        item.put("metadata",metadata)

        val items = NSArray(item)

        root.put("items",items)
        val output = ByteArrayOutputStream()
        PropertyListParser.saveAsXML(root, output)

        println(String(output.toByteArray(),Charsets.UTF_8))
    }
}